package com.cetc39.service.impl;

import java.util.List;

import com.cetc39.bean.Subcycle;
import com.cetc39.dao.SubcycleDao;
import com.cetc39.service.SubcycleService;


public class SubcycleServiceImpl implements SubcycleService {

	private SubcycleDao subcycleDao;
	
	@Override
	public void add(Subcycle sc) {
		subcycleDao.save(sc);
	}

	@Override
	public void update(Subcycle sc) {
		subcycleDao.update(sc);
	}

	@Override
	public List<?> findAll() {
		return subcycleDao.findAll();
	}

	@Override
	public Subcycle findById(int id) {
		return subcycleDao.findById(id);
	}

	@Override
	public void delete(int id) {
		subcycleDao.delete(id);
	}

	public void setSubcycleDao(SubcycleDao subcycleDao) {
		this.subcycleDao = subcycleDao;
	}

	@Override
	public Subcycle findByName(String name) {
		List<?> subList = subcycleDao.findByName(name);
		
		return (Subcycle) subList.get(0);
	}
	
	

}
